package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TPartRankTemp;
import cn.com.headfree.mouldshow.dao.TPartRankTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tPartRankTempDao")
public class TPartRankTempDaoImpl extends BaseDaoImpl<TPartRankTemp> implements TPartRankTempDao {


    @Override
    public void saveInfo(TPartRankTemp tPartRankTemp) {
        String sql = "insert into t_part_rank_temp (id,erp_no,user_name,id_card_no,item_id,item_type,`rank`,role,is_valid,audit_state,org_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
                .append("#{id_card_no,jdbcType=VARCHAR},").append("#{item_id,jdbcType=VARCHAR},")
                .append("#{item_type,jdbcType=VARCHAR},").append("#{rank,jdbcType=VARCHAR},")
                .append("#{role,jdbcType=VARCHAR},").append("#{is_valid,jdbcType=VARCHAR},")
                .append("#{audit_state,jdbcType=VARCHAR},").append("#{org_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tPartRankTemp.getId());
        params.put("erp_no", tPartRankTemp.getErpNo());
        params.put("user_name", tPartRankTemp.getUserName());
        params.put("id_card_no", tPartRankTemp.getIdCardNo());
        params.put("item_id", tPartRankTemp.getItemId());
        params.put("item_type", tPartRankTemp.getItemType());
        params.put("rank", tPartRankTemp.getRank());
        params.put("role", tPartRankTemp.getRole());
        params.put("is_valid", tPartRankTemp.getIsValid());
        params.put("audit_state", tPartRankTemp.getAuditState());
        params.put("org_id", tPartRankTemp.getOrgId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
